package soundwave.com.demo.adpater;

import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import java.util.ArrayList;

import soundwave.com.demo.test.Myadresscontent_test;
import soundwave.com.demo.R;

/**
 * Created by xu on 2017/3/27.
 */

public class MyadressList_adapert extends ArrayAdapter<Myadresscontent_test> {
    private Context context;
    private int layoutid;
    private LayoutInflater inflater=null;
    public MyadressList_adapert(@NonNull Context context, @LayoutRes int resource,  ArrayList<Myadresscontent_test>adresscontent) {
        super(context, resource,adresscontent);
        this.context=context;
        this.layoutid=resource;
    }

    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        View view=convertView;
        if (view==null){
            inflater=LayoutInflater.from(context);
            view=inflater.inflate(layoutid,null);
        }
        Myadresscontent_test myadresscontent_test=getItem(position);
        TextView adress= (TextView) view.findViewById(R.id.shoppingaddress);

        adress.setText(myadresscontent_test.getAdress());
        return view;
    }
}
